﻿using UnityEngine;
using System.Collections;

public class Brid : MonoBehaviour {
    public float timer = 0;
    public int frameNumber = 15;
    public int frameCount = 0;

	void Start () {
       // GetComponent<Rigidbody>().velocity = new Vector3(5,0,0);
	}
	
	void Update () {
       
        timer += Time.deltaTime;
        if (timer>=1.0f/frameNumber)
        {
            frameCount++;
            timer -= 1.0f/frameNumber;
            int frameIndex = frameCount % 3;
            GetComponent<Renderer>().material.SetTextureOffset("_MainTex", new Vector2(0.33f * frameIndex, 0));

        }
	}
}
